<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" href="/css/font.css">
		<link rel="stylesheet" href="/css/xadmin.css">
		<style>
			form {
				margin-top: 10px;
			}
			
		</style>
	</head>
	<body>
		<form class="layui-form" id="updateResitExamTime">
	        <div class="layui-form-item">
               <label class="layui-form-label"><font color="red" size="3">*</font>考试日期</label>
               <div class="layui-input-block">
                   <input type="text" name="examDate" th:attr="value=${#dates.format( resitExam.examDate, 'yyyy-MM-dd')}" required lay-verify="required" id="time" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
					<input type="hidden" name="id" th:attr="value=${resitExam.id}">
               </div>
            </div>
			<div class="layui-form-item">
				<label class="layui-form-label"><font color="red" size="3">*</font>考试时间</label>
				<div class="layui-input-block">
					<input type="text" name="examTime" th:attr="value=${resitExam.examTime}" required lay-verify="required|examTime" placeholder="hh:mm-hh:mm 1-20个字符，且不能出现空格" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo" type="button">立即提交</button>
				</div>
			</div>
		</form>
		
		<script type="text/javascript" src="/js/jquery.min.js"></script>
        <script type="text/javascript" src="/js/xadmin.js"></script>
        <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="/js/vue.min.js"></script>
        <script type="text/javascript" src="/js/jquery.form.js"></script>
		<script>
			layui.use(['form', 'layedit', 'laydate'], function(){
				var form = layui.form
				,layer = layui.layer
				var laydate = layui.laydate;
				laydate.render({
					elem: '#time' //指定元素
			    });
				form.verify({
					examTime: [/^[\S]{1,20}$/,'1-20个字符，且不能出现空格']
				});
			
				//监听提交
				form.on('submit(formDemo)', function(data){
					$.ajax({
                        url : "/sys/resitExam/updateResitExamTime",
                        type : "post",
                        data : $("#updateResitExamTime").serializeArray(),
                        success : function(result) {
                            if (result.state) {
                                layer.msg('保存成功！', {icon: 1,time: 1000}, function(){
                                    // 1.先得到当前iframe层的索引
                                    var index = parent.layer.getFrameIndex(window.name); 
                                    // 2.再执行关闭 
                                    parent.layer.close(index); 
                                    // 调用父页面的方法
                                    window.parent.updateSaveData();
                                });
                            } else {
                                layer.msg(""+result.msg, {icon: 5});
                            }
                        }
                    });
				});
			});
		</script>
	</body>
</html>
